#pragma once

#include "MinkowskiDifference2.h"

/*
class ICollisionHandler
{
public:
	virtual ICollisionHandler() {}

	virtual bool doIntersect(Scalar boundaryTolerance) = 0;

	bool findContactPoint(Scalar boundaryTolerance, 
		Vector2& contactPointA, Vector2& contactPointB, Vector2& normalA, Scalar&  penetrationDistance) = 0;
	
	bool computePenetration(Scalar boundaryTolerance, const Vector2& axis,
							Vector2& contactPointA,
							Vector2& contactPointB,
							Vector2& normalA,
							Scalar& penetrationDistance) = 0;
};
*/

/// collision handler by using XenoCollide
class XenoCollide2 //: public ICollisionHandler
{
public:
	XenoCollide2();
	void setDomain(const IConvexDomain2& domainA, const Vector2& positionA,
	               const IConvexDomain2& domainB, const Vector2& positionB);
	//void setObserver(MPRObserver& observer);

	bool doIntersect(Scalar boundaryTolerance);
	bool findContactPoint(Scalar boundaryTolerance, 
		Vector2& contactPointA, Vector2& contactPointB, Vector2& normalA, Scalar&  penetrationDistance);
	
	/**
	 * @brief compute contact point with specified direction
	 * @pre   already detected hit case */
	bool computePenetration(Scalar boundaryTolerance, const Vector2& axis,
							Vector2& contactPointA,
							Vector2& contactPointB,
							Vector2& normalA,
							Scalar& penetrationDistance);
private:
	MinkowskiDifference2 difference_;
};
